<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <Script>
        /**
         * @param {number[]} digits
         * @return {number[]}
         */
        var plusOne = function (digits) {
            var num;
            const add1 = digits[digits.length - 1] + 1
            if (add1 >= 10) {
                let lod = add1
                let arr = []
                lod.toString().split('').map((v) => {
                    arr.push(v * 1)
                })
                num = arr
            } else {
                num = add1
            }
            let arr = Array.from(arguments).flat()
            arr.splice(arr.length - 1, 1, num)
            return arr.flat()
        };
        console.log(plusOne([9]))
    </Script>
</body>

</html>